<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>随机数</title>
</head>
<body>
    <h1 id="h1">请点击开始</h1>
    <hr>
    <button id="startBtn">开始</button>
    <button id="stopBtn">停止</button>
    <script src="../1811.js"></script>
    <script>
        var students='陈光 王帅 段小乐 徐浩宁 李聪利 史璐蒿 刘入玮 李清飞 张梁 吕爽 杨丰华 张忠元 刘雅丽';
        var studentsArr=students.split(' ');
        var timer;
        
        $('#startBtn').onclick = function(){
            timer = setInterval(function(){
                var index = Math.floor(Math.random()*studentsArr.length);
                $('#h1').innerHTML = studentsArr[index];
           },100);
        };  

        $('#stopBtn').onclick = function(){
            clearInterval(timer);
        };
    </script>
</body>
</html>